package com.can.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.can.domain.po.Replies;
import com.can.domain.po.post;
import com.can.domain.vo.RepliesVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RepliesMapper extends BaseMapper<Replies> {
    @Select("""
            SELECT  
                id,  
                post_id AS postId,  
                user_id AS userId,  
                parent_reply_id AS parentReplyId,  
                content,  
                username,  
                DATE_FORMAT(created_at, '%Y年%c月%e日%H时%i分') AS createdAt 
            FROM replies  
            WHERE post_id = #{postId}
            ORDER BY created_at
            """)
    List<RepliesVo> getRepliesByPostId(int postId);



}
